package com.jetgege.smartbox.Me;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;

import com.jetgege.smartbox.Base.BaseActivity;
import com.jetgege.smartbox.R;

import butterknife.BindView;
import butterknife.OnClick;

public class MeActivity extends BaseActivity {

    @BindView(R.id.me_toolbar)
    Toolbar meToolbar;
    MeAdpter meAdpter;
    @BindView(R.id.lv_MeView)
    ListView lvMeView;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_me;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initValue();
    }

    private void initValue() {
        meAdpter = new MeAdpter();
        meToolbar.setTitle("我");
        setSupportActionBar(meToolbar);
        lvMeView.setAdapter(meAdpter);
        // Navigation Icon 要設定在 setSupoortActionBar 才有作用
        // 否則會出現 back button
        meToolbar.setNavigationIcon(R.drawable.bar_back_btn);
        meToolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
                overridePendingTransition(R.anim.in_from_left, R.anim.out_to_right);
            }
        });

        lvMeView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                switch (position)
                {
                    case 0:
                        startActivity(new Intent(MeActivity.this,ModifyPWDActivity.class));
                        break;
                    case 1:
                        startActivity(new Intent(MeActivity.this,DevicePWDActivity.class));
                        break;
                    default:break;
                }
                overridePendingTransition(R.anim.in_from_right, R.anim.out_to_left);
            }
        });
    }

    @OnClick(R.id.bt_LogOut)
    public void onViewClicked() {
    }
}
